﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace Friedlich.Common
{
    public static class Extensions
    {
        public static string GetElementValue(this XElement element, string ns, string name)
        {
            string elementValue = string.Empty;
            XElement elem = element.Element(XName.Get(name, ns));
            if (elem != null)
            {
                elementValue = elem.Value;
            }
            return elementValue;
        }

        public static string GetElementRelationship(this XElement element) {
            string relationship = string.Empty;
            XAttribute attr =  element.Attribute(XName.Get("rel"));
            if (attr != null) {
                relationship = attr.Value;
            }
            return relationship;
        }
    }
}
